home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / A-B / AutoHelp Demo.cpt / AutoHelp Demo / card_3033.txt < prev    next >
Text File  |  1989-02-26  |  7KB  |  240 lines

  1. -- card: 3033 from stack: in
  2. -- bmap block id: 3165
  3. -- flags: 4000
  4. -- background id: 2722
  5. -- name: Title
  6. ----- HyperTalk script -----
  7. --
  8. -- AutoHelp Script
  9. --
  10. -- by Richard Johnson
  11. --
  12. -- GEnie: RJ.JOHNSON
  13. -- Snail Mail: 4035 Darley
  14. --             Boulder, CO 80303
  15. --
  16. --  This script will kick the user into help (or wherever else the user
  17. --  needs to be kicked) if he or she aimlessly clicks the mouse too
  18. --  many times in short order.  (It will also, just for a meaningless
  19. --  demonstration, do the same if the user taps that totally useless
  20. --  "enter" key.)
  21. --
  22. --  This script was written after watching one utterly confused lady
  23. --  try out HyperCard on a dealer's demonstration Mac one day.  She was
  24. --  very upset when she repeatedly pushed that big button on the uh,
  25. --  mouse, yeah, that's right - but nothing happened.  The fact that
  26. --  the stack had no readily visible buttons only contributed to her
  27. --  confusion.  I figured there had to be a way to help those sorts of
  28. --  disadvantaged people find the one true path, hence the birth of
  29. --  this modest little script.
  30. --
  31. --  (Thanks be to Bill Atkinson for HyperCard, and to Bo3b Johnson for
  32. --  getting me interested in the Mac in the first place.)
  33.  
  34. on openCard
  35.   global maxNumClicks
  36.   global delay
  37.  
  38.   --  The number of aimless clicks before the help is triggered
  39.   --  is in "maxNumClicks".
  40.   --  "Delay" is the number of seconds after the last aimless click at
  41.   --  which the click counter is cleared.
  42.  
  43.   --  Set up those globals where we can get at 'em easy.
  44.   put 3 into maxNumClicks  --  a pure, unadulterated number
  45.   put 3 into delay  --  seconds - a number with meaning
  46.   --  Hide the help until the user has acted "confused".
  47.   hide card field "About AutoHelp Demo"
  48.   set the lockText of card field "About AutoHelp Demo" to true
  49. end openCard
  50.  
  51.  
  52. on mouseUp
  53.   global timeOut
  54.   global aimlessClicks
  55.   global maxNumClicks
  56.   global delay
  57.  
  58.   --  The count of aimless clicks since the last time out is in
  59.   --  "aimlessClicks".
  60.   --  The time at which the count is to be zeroed is stored in
  61.   --  "timeOut".
  62.  
  63.   --  Maybe the click is not aimless.  After all, if the user _has_
  64.   --  found the option key.
  65.   if the optionKey is down then
  66.     edit script of target
  67.     exit mouseUp
  68.   end if
  69.  
  70.   --  Check to see if the help has already been activated, and bail
  71.   --  out if so
  72.   if the visible of card field "About Autohelp Demo" is true then exit mouseup
  73.  
  74.   --  Set the time at which aimlessClicks will be reset if this just
  75.   --  happens to be the user's last aimless click.
  76.   put the seconds + delay into timeOut
  77.   add 1 to aimlessClicks
  78.   --  Check aimlessClicks against the trigger level and declare the
  79.   --  user confused if necessary.
  80.   if aimlessClicks >= maxNumClicks then
  81.     put 0 into aimlessClicks
  82.     confusedUser
  83.   end if
  84. end mouseUp
  85.  
  86.  
  87. on idle
  88.   global timeOut
  89.   global aimlessClicks
  90.   --  Reset aimlessClicks if the user hasn't clicked in a short while.
  91.   if the seconds > timeOut then put 0 into aimlessClicks
  92.   pass idle  --  Or don't if you don't want to
  93. end idle
  94.  
  95.  
  96. on enterKey
  97.   --  Yes, you can do it by pressing a key too.
  98.   if the visible of card field "About AutoHelp Demo" is false then confusedUser
  99. end enterKey
  100.  
  101.  
  102. on confusedUser
  103.  
  104.   --  The user is lost (by definition!), so give him or her a chance
  105.   --  for help.
  106.  
  107.   --  No offense intended here, but if you want to take offense
  108.   --  anyway you're certainly welcome to as much as you can carry.
  109.   answer "Do you need help?" with "Oh God Yes" or "Uh uh"
  110.   if it is "Oh God Yes" then
  111.     --  Set up your own dirty work here...
  112.     show card field "About AutoHelp Demo"
  113.   end if
  114. end confusedUser
  115.  
  116.  
  117. on CloseStack
  118.  
  119.   --  An added bonus!  Since so many stacks were uploaded to BBSes and
  120.   --  so on without being compacted first, my friends (yes, I have a
  121.   --  few of those) and I decided this neat little reminder would be
  122.   --  used, without complaint, by the chronically forgetful among us.
  123.  
  124.   put the short name of this stack into stackName
  125.   answer "Compact" && stackName && "first?" with "Please Do" or "No Thanks"
  126.   if it is "Please Do" then domenu compact stack
  127.   pass CloseStack
  128. end CloseStack
  129.  
  130.  
  131.  
  132. -- part 14 (field)
  133. -- low flags: 81
  134. -- high flags: 2007
  135. -- rect: left=283 top=86 right=262 bottom=493
  136. -- title width / last selected line: 0
  137. -- icon id / first selected line: 0 / 0
  138. -- text alignment: 0
  139. -- font id: 3
  140. -- text size: 12
  141. -- style flags: 0
  142. -- line height: 16
  143. -- part name: About AutoHelp Demo
  144. ----- HyperTalk script -----
  145. on mouseUp
  146.   if the optionKey is down then
  147.     pass mouseUp
  148.   end if
  149.  
  150.   hide card field "About Autohelp Demo"
  151. end mouseUp
  152.  
  153.  
  154.  
  155. -- part 15 (field)
  156. -- low flags: 01
  157. -- high flags: 0000
  158. -- rect: left=269 top=28 right=62 bottom=480
  159. -- title width / last selected line: 0
  160. -- icon id / first selected line: 0 / 0
  161. -- text alignment: 1
  162. -- font id: 3
  163. -- text size: 12
  164. -- style flags: 2304
  165. -- line height: 16
  166. -- part name: 
  167.  
  168.  
  169. -- part 16 (field)
  170. -- low flags: 01
  171. -- high flags: 0000
  172. -- rect: left=254 top=286 right=322 bottom=490
  173. -- title width / last selected line: 0
  174. -- icon id / first selected line: 0 / 0
  175. -- text alignment: 1
  176. -- font id: 3
  177. -- text size: 12
  178. -- style flags: 2304
  179. -- line height: 16
  180. -- part name: 
  181.  
  182.  
  183. -- part 17 (button)
  184. -- low flags: 00
  185. -- high flags: 0003
  186. -- rect: left=25 top=47 right=75 bottom=61
  187. -- title width / last selected line: 0
  188. -- icon id / first selected line: 21847 / 21847
  189. -- text alignment: 1
  190. -- font id: 0
  191. -- text size: 12
  192. -- style flags: 0
  193. -- line height: 16
  194. -- part name: New Button
  195. ----- HyperTalk script -----
  196. on mouseUp
  197.   if the optionKey is down then
  198.     pass mouseUp
  199.   end if
  200.  
  201.   if the commandKey is down then go home
  202.   else pass mouseUp
  203. end mouseUp
  204.  
  205.  
  206.  
  207. -- part contents for card part 14
  208. ----- text -----
  209. Welcome to the AutoHelp Demonstration stack.  Autohelp is a script that resides in the card or stack, intercepts aimless mouse clicks, and gives the user the option of getting help if too many aimless clicks are made.  Believe it or not, it actually has helped a few first time Mac/HyperCard users.  (OK, so I lied.)
  210.  
  211. So How's it Done?
  212. Option-click somewhere on the card to get a look at the script that makes it all possible.
  213.  
  214. About the About:
  215. This is the "About AutoHelp Demo" field.  If you don't believe me, then check it out yourself (I dare ya).  Click on it to get rid of it.
  216.  
  217. Ruby Slippers:
  218. Command-click on the house when you've had enough and want to go home.
  219.  
  220. Obligatory Disclaimer:  
  221. This demonstration script works, but I can't be held responsible for what horrors you perpetrate on your own stacks - especially since this script is in the public domain.
  222.  
  223. About the Picture:
  224. Just in case you were wondering, the picture on this card has nothing to do with what the stack demonstrates.  The picture does, however, have a lot to do with the currently moribund US space program.
  225.  
  226. Sad, but true.  Time for Americans to learn Japanese or Russian, it seems.  At least with the Script Manager we'll still be able to use HyperCard.
  227.  
  228. Richard Johnson
  229.  
  230.  
  231.  
  232. -- part contents for card part 15
  233. ----- text -----
  234. AutoHelp Demonstration by Richard Johnson
  235.  
  236.  
  237. -- part contents for card part 16
  238. ----- text -----
  239. Click quickly 3 or so times anywhere on the card
  240.